import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex);

const store = new Vuex.Store({  
    state: {  
        hasLogin: false,
		token: '',
		userInfo: {},
    }, 
	getters: {
		hasLogin: (state) => state.hasLogin,
		token: (state) => state.token,
		userInfo: (state) => state.userInfo,
	}, 
    mutations: {  
        login(state, provider) {
            //console.log(state);
            //console.log(provider);
			
			state.hasLogin = true;
			state.token = provider.token;
			state.userInfo = provider;  

        },  
        logout(state) {
			state.hasLogin = false;
			state.token = '';
			state.userInfo = {};
        },
		updateUserInfo(state, provider) {
		    //console.log(state);
		    //console.log(provider);
			state.userInfo = provider;
		},
    },
	actions: {
	
	}
})  

export default store
